package com.jiai.cloud.feign;
import com.jiai.cloud.entity.TPage;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
 * Created by Administrator on 2017/5/27.
 */

@FeignClient("authentication")
public interface PageAPI {

    //增
    @RequestMapping(value="/api/v1/page/addPage", produces = {"application/json;charset=UTF-8"}, method = POST)
    Object addPage(@RequestBody TPage tPage);

    //删
    @RequestMapping(value="/api/v1/page/delete/{id}", produces = {"application/json;charset=UTF-8"}, method = POST)
    Object delete(@PathVariable("id") Integer id);

    //ID查
    @RequestMapping(value = "/api/v1/page/findById/{id}", produces = {"application/json;charset=UTF-8"},method = GET)
    Object selectById(@PathVariable("id") Integer id);

    //查所有
    @RequestMapping(value = "/api/v1/page/findByAll/{page}", produces = {"application/json;charset=UTF-8"},method = GET)
    Object selectPage(@PathVariable("page") Integer page);

    //改(有就改，没有就插入)
    @RequestMapping(value="/api/v1/page/edit", produces = {"application/json;charset=UTF-8"}, method = POST)
    @ResponseBody
    Object edit(TPage tPage);
}